package org.example.entity;

import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Objects;


public class CommonResult<T> implements Serializable {
	private Integer code;
	@ApiModelProperty("提示信息")
	private String msg;
	private T data;

	public CommonResult() {
	}

	public CommonResult(Integer code, String msg, T data) {
		this.code = code;
		this.msg = msg;
		this.data = data;
	}

	public CommonResult(Integer code, T data) {
		this.code = code;
		this.data = data;
	}

	public CommonResult(Integer code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	@Override
	public String toString() {
		return "CommonResult{" +
				"code=" + this.code +
				", msg='" + this.msg + '\'' +
				", data=" + this.data +
				'}';
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || this.getClass() != o.getClass()) {
			return false;
		}
		CommonResult<?> that = (CommonResult<?>) o;
		return Objects.equals(this.code, that.code) && Objects.equals(this.msg, that.msg) && Objects.equals(this.data, that.data);
	}

	@Override
	public int hashCode() {
		return Objects.hash(this.code, this.msg, this.data);
	}

	public Integer getCode() {
		return this.code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return this.msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public T getData() {
		return this.data;
	}

	public void setData(T data) {
		this.data = data;
	}
}

